package jjn.acwing.daily;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/8/17 21:34
 */
public class Acwing5081 {
    
    public static void main(String[] args) {
        Map<String, Integer> countMap = new HashMap<>();
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            StringBuilder stringBuilder = new StringBuilder();
            for (int j = 0; j < 8; j++) {
                stringBuilder.append(scanner.next());
            }
            String chess = stringBuilder.toString();
            countMap.put(chess, countMap.getOrDefault(chess, 0) + 1);
            System.out.println(countMap.get(chess));
        }
    }
}
